﻿<%@ Page Language="C#"  MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="TR_LecturerSkills.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.TR_LecturerSkills" %>
<%@ Register Src="../Controls/user.ascx" TagName="user" TagPrefix="uc1" %>

<asp:Content ID="ContentTRLecturerSkill" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }                                
            </script>       
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="TRLecturerSkill">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="TRLecturerSkill" LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>    
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None" Skin="Outlook">
    </telerik:RadAjaxLoadingPanel>
    
    <asp:Panel ID="TRLecturerSkill" runat="server">  
        <table width="1000" cellpadding="0" cellspacing="0">
        <tr>
            <td valign="top">
                <!-- <uc1:user ID="user1" runat="server" /> -->
            </td>
        </tr> 
        <tr>
        <td> 
        <telerik:RadTabStrip 
                    ID="RadTabStrip1" 
                    runat="server" 
                    MultiPageID="RadMultiPage1"
                    SelectedIndex="0" 
                    CausesValidation="False" 
                    Skin="Office2007"
                    Width="430px">
                    <Tabs>
                        <telerik:RadTab Text="จำแนกตามวิทยากร" Width="50%" Selected="True">
                        </telerik:RadTab>
                        <telerik:RadTab Text="จำแนกตามรายวิชา"  Width="50%">
                        </telerik:RadTab>
                    </Tabs>
                </telerik:RadTabStrip>
<%--======================           จำแนกตามวิทยากร        ============================ --%> 
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">                
                <telerik:RadPageView ID="RadPageView4" runat="server" Width="980px">       
                                      
                <div class="moduleDivSlim1000x450">
                <div class="moduleDivBottom1000">
                <table align="center" width="980px">
                <tr>
                    <td align="left" class="tableHeader">
                        ความชำนาญของวิทยากร
                    </td>
                </tr>
                </table>
                                        
                
                <table align="center" style="height:380px; width: 988px;">
                <tr align="center">
                    <td>       
                        <asp:Panel ID="tblTRLecturerSkill" 
                            runat="server" 
                            align="center" 
                            Height="380px" 
                            Visible="true"
                            ScrollBars="Auto" 
                            Width="980px">
                            <telerik:RadGrid ID="grdTRLecturerSkill"
                                runat="server"
                                AllowAutomaticDeletes="True" 
                                AllowFilteringByColumn="True" 
                                AllowMultiRowEdit="True" 
                                AllowMultiRowSelection="True" 
                                AllowPaging="True" 
                                AllowSorting="True" 
                                AutoGenerateColumns="False" 
                                EnableAJAX="True" 
                                EnableAJAXLoadingTemplate="True"
                                GridLines="None" 
                                Height="365px"
                                Width="975px" 
                                Skin="Outlook"
                                OnItemCommand="grdTRLecturerSkill_ItemCommand">
                                <MasterTableView
                                    AllowMultiColumnSorting="True"                                                 
                                    GroupsDefaultExpanded="true"
                                    GroupLoadMode="Client"
                                    CellSpacing="-1" 
                                    ClientDataKeyNames="training_cap_seq" 
                                    CommandItemDisplay="Top"                                                         
                                    DataKeyNames="training_cap_seq"                                                    
                                    NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                    <CommandItemTemplate>
                                        <table align="left">
                                        <tr>
                                            <td align="left">
                                            <asp:LinkButton ID="AddDataSubject"
                                                    runat="server" 
                                                    CommandName="AddDataSubject"
                                                    Visible="true">
                                                    <img style="border:0px;vertical-align:middle;" alt=""
                                                    src="../Images/Buttons/AddRecord.gif" /> เพิ่มข้อมูลรายวิชา
                                                   
                                            </asp:LinkButton>  
                                            </td>
                                            <td align="right">
                                            
                                            </td>
                                        </tr>                                                   
                                        </table>
                                    </CommandItemTemplate>
                                    <GroupByExpressions>
                                    <telerik:GridGroupByExpression>
                                        <GroupByFields>
                                            <telerik:GridGroupByField FieldName="trainer_seq" />
                                        </GroupByFields>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="trainer" HeaderText="วิทยากร"  />
                                        </SelectFields>
                                    </telerik:GridGroupByExpression>
                                </GroupByExpressions>
                                    <Columns>
                                       <%--  <telerik:GridTemplateColumn  
                                            HeaderStyle-Width="20px"                                                                                                                     
                                            HeaderStyle-HorizontalAlign="Center" 
                                            ShowFilterIcon="false"
                                            AllowFiltering="false">
                                            <ItemTemplate>
                                                <table>
                                                    <asp:ImageButton 
                                                        ID="cmdDelete" 
                                                        runat="server" 
                                                        CommandName="Delete"
                                                        OnClientClick="javascript: return confirm('ลบข้อมูลที่เลือก?');"
                                                        ImageUrl="../Images/Buttons/Delete.gif" 
                                                        ToolTip="ลบรายการ" 
                                                        width="20px" />
                                                </table>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" Width="20px" />
                                        </telerik:GridTemplateColumn> --%>
                                   <telerik:GridBoundColumn  DataField="training_cap_seq" UniqueName="training_cap_seq" Visible="False"
                                         ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                                   </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn  DataField="training_subject_seq" UniqueName="training_subject_seq" Visible="False"
                                         ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                                   </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn HeaderText="รหัสวิทยากร" DataField="trainer_seq" UniqueName="trainer_seq" Visible="False"
                                         ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" FilterControlWidth="100%">
                                   </telerik:GridBoundColumn>
                                  <telerik:GridButtonColumn HeaderText="แก้ไข" ImageUrl="../Images/Buttons/Edit.gif" ButtonType="ImageButton" CommandName="GridEdit">
                                   </telerik:GridButtonColumn>
                                   <telerik:GridButtonColumn HeaderText="ลบ" ImageUrl="../Images/Buttons/Delete.gif" ButtonType="ImageButton" CommandName="Delete">
                                   </telerik:GridButtonColumn>
                                   <telerik:GridBoundColumn HeaderText="วิทยากร" DataField="trainer" UniqueName="trainer"
                                         ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="False" FilterControlWidth="100%">
                                        <HeaderStyle Width="420px" />
                                   </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn HeaderText="รายวิชา" DataField="training_subject" UniqueName="training_subject"
                                         ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="False" FilterControlWidth="100%">
                                        <HeaderStyle Width="420px" />
                                   </telerik:GridBoundColumn>
                                   <%-- <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="training_subject" 
                                            HeaderText="รายวิชา" 
                                            ShowFilterIcon="false" 
                                            UniqueName="training_subject"> 
                                        </telerik:GridBoundColumn>   
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="trainer_seq" 
                                            DataType="System.Int32"
                                            HeaderText="รหัสวิทยากร" 
                                            ShowFilterIcon="false" 
                                            UniqueName="trainer_seq"
                                            Visible="False">
                                        </telerik:GridBoundColumn>
                                        
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="trainer"                                             
                                            HeaderText="วิทยากร" 
                                            ShowFilterIcon="false" 
                                            Visible="true"
                                            UniqueName="trainer">
                                            <HeaderStyle Width="50%" />
                                        </telerik:GridBoundColumn>
                                        
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="training_subject" 
                                            HeaderText="รายวิชา" 
                                            ShowFilterIcon="false" 
                                            UniqueName="training_subject"> 
                                        </telerik:GridBoundColumn>                                                        
                                                                                               
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="training_cap_seq" 
                                            DataType="System.Int32"
                                            ShowFilterIcon="false" 
                                            UniqueName="training_cap_seq"
                                            Visible="false">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn
                                            DataField="training_subject_seq"
                                            UniqueName="training_subject_seq" 
                                            Visible="False">
                                        </telerik:GridBoundColumn>  --%>
                                    </Columns>
                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                    </MasterTableView>
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="true" />
                                        <Scrolling AllowScroll="true" UseStaticHeaders="True" />
                                    </ClientSettings>
                                </telerik:RadGrid>
                        </asp:Panel> 
                        <asp:HiddenField ID="hdfTrainerCapSeq" runat="server" />
                        <asp:Panel ID="LecturerSkillEdit" 
                            runat="server"
                            Visible="false"
                            Height="350px" 
                            width="950px" 
                            align="center">
                            <ul class="formList890px">
                                <li>
                                    <table align="center" style="width: 300px" >
                                        <tr>
                                            <td align="left" class="tableDetailHeader" style="width: 300px" colspan = "2">
                                                ข้อมูลรายวิชา
                                            </td>
                                        </tr>
                                    </table>
                                </li>
                                <li>
                                <table>
                                    <tr>  
                                        <td align="right">
                                            รายชื่อวิทยากร :
                                        </td> 
                                        <td align="left">
                                            <telerik:RadComboBox 
                                                runat="server" 
                                                ID="cbLecturer" 
                                                AllowCustomText ="true" 
                                                DataTextField="trainer_name" 
                                                DataValueField="trainer_seq" 
                                                Filter ="Contains"
                                                CausesValidation ="false"
                                                OnClientTextChange = "onTextChange"
                                                EmptyMessage = "...เลือกวิทยากร..."
                                                Width="250px" ZIndex="8000">
                                            </telerik:RadComboBox> 
                                            <span class="validate">*</span>
                                            <asp:RequiredFieldValidator 
                                                runat="server" 
                                                ID="RequiredFieldValidator6" 
                                                ControlToValidate="cbLecturer"
                                                ErrorMessage="กรุณากรอกข้อมูลรายชื่อวิทยากร" >
                                            </asp:RequiredFieldValidator>                                                    
                                        </td> 
                                    </tr>                                        
                                    <tr>  
                                        <td align="right">
                                            รายวิชา :
                                        </td> 
                                        <td align="left">
                                            <telerik:RadComboBox 
                                                runat="server" 
                                                ID="cbSubject" 
                                                AllowCustomText ="true" 
                                                DataTextField="training_subject_descr" 
                                                DataValueField="training_subject_seq" 
                                                Filter ="Contains"
                                                CausesValidation ="false"
                                                OnClientTextChange = "onTextChange"
                                                EmptyMessage = "...เลือกรายวิชา..."
                                                Width="350px" ZIndex="8000">
                                            </telerik:RadComboBox>   
                                            <span class="validate">*</span>
                                            <asp:RequiredFieldValidator 
                                                runat="server" 
                                                ID="RequiredFieldValidator1" 
                                                ControlToValidate="cbSubject"
                                                ErrorMessage="กรุณากรอกข้อมูลรายวิชา" >
                                            </asp:RequiredFieldValidator>                                                 
                                        </td>  
                                    </tr>
                                </table>
                                
                                </li>                                   
                            </ul>
                            <div id="" style="margin-left:220px; width:400px;">
                                <table width="400px">
                                    <tr>                                    
                                    <td align="left" style="width: 250px">
                                        <asp:Button ID="btnSave" onclick="btnSave_Click" runat="server" CssClass="button" Text="บันทึก" Width="80px" />  
                                        <asp:Button ID="btnUpdate" runat="server" CssClass="button" Text="บันทึก" 
                                            Width="80px" onclick="btnUpdate_Click" /> 
                                        <asp:Button ID="btnCancel" OnClick="btnCancel_Click" CausesValidation="false" runat="server" CssClass="button" Text="ยกเลิก" Width="80px" /> 
                                    </td>
                                  </tr>
                                </table>
                           </div>
                        </asp:Panel>                             
                    </td> 
                    </tr>
                 </table>                
                </div>
                </div>
            </telerik:RadPageView>
    <%--==============================           จำแนกตามรายวิชา        =================================== --%>   
            <telerik:RadPageView ID="RadPageView1" runat="server">
            <div class="moduleDivSlim1000x450">
            <div class="moduleDivBottom1000">
            <table align="center" width="980px">
                <tr>
                    <td align="left" class="tableHeader">
                        ความชำนาญของวิทยากร
                    </td>
                </tr>
                </table>
                <table align="center" style="height:300px; width: 964px;">
                <tr>
                    <td style="height: 374px">
                    <asp:Panel ID="PanelRadGrid1" 
                        runat="server" 
                        align="center" 
                        Height="380px" 
                        Visible="true"
                        ScrollBars="Auto" 
                        Width="980px">
                        <telerik:RadGrid ID="RadGrid1"
                            runat="server"
                            AllowAutomaticDeletes="True" 
                            AllowFilteringByColumn="True" 
                            AllowMultiRowEdit="True" 
                            AllowMultiRowSelection="True" 
                            AllowPaging="True" 
                            AllowSorting="True" 
                            AutoGenerateColumns="False" 
                            EnableAJAX="True" 
                            EnableAJAXLoadingTemplate="True"
                            GridLines="None" 
                            Height="365px"
                            Width="975px" 
                            Skin="Outlook"
                            OnItemCommand="RadGrid1_ItemCommand">
                            <MasterTableView
                                AllowMultiColumnSorting="True"                                                 
                                GroupsDefaultExpanded="true"
                                GroupLoadMode="Client"
                                CellSpacing="-1" 
                                ClientDataKeyNames="training_cap_seq" 
                                CommandItemDisplay="Top"                                                         
                                DataKeyNames="training_cap_seq"                                                    
                                NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                <CommandItemTemplate>
                                    <table align="left">
                                    <tr>
                                        <td align="left">
                                        <asp:LinkButton ID="AddDataTrainer"
                                                runat="server" 
                                                CommandName="AddDataTrainer"
                                                Visible="true">
                                                <img style="border:0px;vertical-align:middle;" alt=""
                                                src="../Images/Buttons/AddRecord.gif" /> เพิ่มข้อมูลรายวิชา
                                               
                                        </asp:LinkButton>  
                                        </td>
                                        <td align="right">
                                        
                                        </td>
                                        </tr>                                                   
                                        </table>
                                    </CommandItemTemplate>
                                    <GroupByExpressions>
                                    <telerik:GridGroupByExpression>
                                        <GroupByFields>
                                            <telerik:GridGroupByField FieldName="training_subject_seq" />
                                        </GroupByFields>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldName="training_subject" HeaderText="รายวิชา"  />
                                        </SelectFields>
                                    </telerik:GridGroupByExpression>
                                </GroupByExpressions>
                                    <Columns>                                                   
                                        
                                        <telerik:GridTemplateColumn                                                                                                                     
                                            HeaderStyle-HorizontalAlign="Center" 
                                            ShowFilterIcon="false"
                                            AllowFiltering="false">
                                            <ItemTemplate>
                                                <table>
                                                    <asp:ImageButton 
                                                        ID="cmdDeleteTrainer" 
                                                        runat="server" 
                                                        CommandName="DeleteTrainer"
                                                        OnClientClick="javascript: return confirm('ลบข้อมูลที่เลือก?');"
                                                        ImageUrl="../Images/Buttons/Delete.gif" 
                                                        ToolTip="ลบรายการ" 
                                                        width="20px" />
                                                </table>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" Width="20px" />
                                        </telerik:GridTemplateColumn> 
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="training_subject" 
                                            FilterControlWidth="100%" 
                                            HeaderText="รายวิชา" 
                                            ShowFilterIcon="false"
                                            Visible="true" 
                                            UniqueName="training_subject"> 
                                            <HeaderStyle HorizontalAlign="Center" />                                                          
                                            <ItemStyle HorizontalAlign="Left" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="trainer" 
                                            FilterControlWidth="100%" 
                                            HeaderText="วิทยากร" 
                                            ShowFilterIcon="false" 
                                            UniqueName="trainer">
                                            <HeaderStyle HorizontalAlign="Center"/>
                                            <ItemStyle HorizontalAlign="Left" />
                                        </telerik:GridBoundColumn>                                                        
                                        <telerik:GridBoundColumn 
                                            DataField="trainer_seq"
                                            UniqueName="trainer_seq" 
                                            Visible="False">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn 
                                            AutoPostBackOnFilter="true" 
                                            CurrentFilterFunction="Contains" 
                                            DataField="training_cap_seq" 
                                            DataType="System.Int32"
                                            FilterControlWidth="100%"                                                         
                                            ShowFilterIcon="false" 
                                            UniqueName="training_cap_seq"
                                            Visible="False">
                                            <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn
                                            DataField="training_subject_seq"
                                            UniqueName="training_subject_seq" 
                                            Visible="False">
                                        </telerik:GridBoundColumn> 
                                    </Columns>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            </MasterTableView>
                            <ClientSettings>
                                <Selecting AllowRowSelect="true" />
                                <Scrolling AllowScroll="true" UseStaticHeaders="True" />
                            </ClientSettings>
                        </telerik:RadGrid>
                    </asp:Panel>  
                    <asp:Panel ID="PanelAddData" 
                        runat="server"
                        Visible="false" 
                        Height="350px" 
                        width="950px"  
                        align="center">
                        <ul class="formList890px">
                            <li>
                                <table align="center" style="width: 430px" >
                                    <tr>
                                        <td align="left" class="tableDetailHeader" style="width: 430px" colspan = "2">
                                            ข้อมูลรายวิชา
                                        </td>
                                    </tr>
                                </table>
                            </li>
                            <li>
                            <table>                                                                    
                                <tr>  
                                    <td align="right">
                                        รายวิชา :
                                    </td> 
                                    <td align="left">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="RadComboBox2" 
                                            AllowCustomText ="true" 
                                            DataTextField="training_subject_descr" 
                                            DataValueField="training_subject_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายวิชา..."
                                            Width="350px" ZIndex="8000">
                                        </telerik:RadComboBox> 
                                         <span class="validate">*</span>
                                        <asp:RequiredFieldValidator 
                                            runat="server" 
                                            ID="RequiredFieldValidator3" 
                                            ControlToValidate="RadComboBox2"
                                            ErrorMessage="กรุณากรอกข้อมูลรายวิชา" >
                                        </asp:RequiredFieldValidator>                                                   
                                    </td>                                    
                                </tr>
                                <tr>  
                                    <td align="right">
                                        รายชื่อวิทยากร :
                                    </td> 
                                    <td align="left">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="RadComboBox1" 
                                            AllowCustomText ="true" 
                                            DataTextField="trainer_name" 
                                            DataValueField="trainer_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกวิทยากร..."
                                            Width="250px" ZIndex="8000">
                                        </telerik:RadComboBox>   
                                        <span class="validate">*</span>
                                        <asp:RequiredFieldValidator 
                                            runat="server" 
                                            ID="RequiredFieldValidator2" 
                                            ControlToValidate="RadComboBox1"
                                            ErrorMessage="กรุณากรอกข้อมูลรายชื่อวิทยากร" >
                                        </asp:RequiredFieldValidator>                                                  
                                    </td> 
                                </tr>
                            </table>                            
                            </li>                                   
                        </ul>
                        <table width="400px">
                            <tr>                                    
                            <td align="right" style="width: 200px">
                                <asp:Button ID="btnSaveTrainer" onclick="btnSaveTrainer_Click" runat="server" CssClass="button" Text="บันทึก" Width="80px" />  
                            </td>
                            <td align="left">
                                <asp:Button ID="btnCancelTrainer" OnClick="btnCancelTrainer_Click" CausesValidation="false" runat="server" CssClass="button" Text="ยกเลิก" Width="80px" />
                            </td>
                            </tr>
                        </table>
                    </asp:Panel>                              
                    </td> 
                </tr>                           
                </table>
            </div>
            </div>
            </telerik:RadPageView>
            </telerik:RadMultiPage>      
            </td>
         </tr>        
        </table>        
    </asp:Panel>
</asp:Content>
